package clientset

import (
	"gitverse.ru/synapse/kubelatte/pkg/api/v1alpha1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/runtime"
	"k8s.io/apimachinery/pkg/runtime/schema"
)

const (
	GroupName    = "kubelatte.io"
	GroupVersion = "v1alpha1"
)

var (
	SchemeBuilder      = runtime.NewSchemeBuilder(addKnownTypes)
	AddToScheme        = SchemeBuilder.AddToScheme
	SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: GroupVersion}
)

func addKnownTypes(scheme *runtime.Scheme) error {
	scheme.AddKnownTypes(SchemeGroupVersion,
		&v1alpha1.Template{},
		&v1alpha1.TemplateList{},
		&v1alpha1.Trigger{},
		&v1alpha1.TriggerList{},
		&v1alpha1.Scope{},
		&v1alpha1.ScopeList{},
		&v1alpha1.TriggerInstance{},
		&v1alpha1.TriggerInstanceList{},
	)

	metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
	return nil
}
